package com.yiwei.hdb.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.yiwei.hdb.R;
import com.yiwei.hdb.adapter.base.ItemAdapter;
import com.yiwei.hdb.model.PointLogModel;
import com.yiwei.hdb.util.DateTime;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by Administrator on 2016/10/17 0017.
 */

public class CreditScoreAdapter extends ItemAdapter<PointLogModel.Data.DataList, CreditScoreAdapter.CreditScoreViewHolder> {


    public CreditScoreAdapter(Context context) {
        super(context);
    }

    @Override
    public CreditScoreViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        return new CreditScoreViewHolder(inflate(R.layout.item_credit_score, parent));
    }

    @Override
    public void onBindViewHolder(CreditScoreViewHolder holder, int position) {
        PointLogModel.Data.DataList item = getItem(position);
        holder.txtContent.setText(item.type);
        holder.txtScore.setText(item.point);
        holder.txtTime.setText(DateTime.toDateTime(item.create_time*1000));
    }

    static class CreditScoreViewHolder extends RecyclerView.ViewHolder {
        @BindView(R.id.txt_content)
        TextView txtContent;
        @BindView(R.id.txt_time)
        TextView txtTime;
        @BindView(R.id.txt_score)
        TextView txtScore;

        public CreditScoreViewHolder(View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
        }
    }
}
